﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameStateManagement
{
    public class Missile : Actor
    {
        public static int m_MissileLifeTime = 3000;

        public int spawnTime;

        public Force missileForce;

        public float speed;

        public Vector3 moving_vector;

        private bool flag;

        public bool Enemy_Missile
        {
            get
            {
                return flag;
            }
            set
            {
                flag = value;
            }
        }

        public float Speed
        {
            set
            {
                speed = value;
            }
            get
            {
                return speed;
            }
        }

        /// <summary>
        /// This is a game component that implements IUpdateable.
        /// </summary>
        public Missile(Game game)
            : base(game)
        {
            sMeshName = "Missile";
            spawnTime = System.Environment.TickCount;

            fMass = 0.1f;
            fTerminalVelocity = 5000.0f;
            vAcceleration = Vector3.Zero;
            bPhysicsDriven = false;
            m_fScale = 5;
            speed = 3000;
            moving_vector = Vector3.Zero;

            //missileForce = CreateForce();
        }

        public override void Update(GameTime gameTime)
        {
            if (!GameplayScreen.pause && !GameplayScreen.gameOver)
            {
                m_vVelocity = moving_vector * speed * (float)gameTime.ElapsedGameTime.TotalSeconds;
                m_vWorldPosition += m_vVelocity;
                base.Update(gameTime);
            }
        }
    }
}
